package module1;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

public class randomBall {

    public static void main(String[] args) {
        Random random = new Random();

        String result = "";
        List<Integer> list = new ArrayList<>();
        // 6个红球
        for (int i=0;i<6;i++){
            while (true){
                int redBall = random.nextInt(32)+1;
                if (list.contains(redBall)){
                    System.out.println("第" + i + "次出现出现了重复的数字，重复数字:" + redBall);
                    continue;
                }else{
                    list.add(redBall);
                    result += String.valueOf(redBall) + "-";
                    break;
                }
            }
        }

        int blueBall = random.nextInt(15)+1;
        result += String.valueOf(blueBall);

        System.out.println(result);






    }

}
